﻿using System;

namespace Ultima.Xna
{
    public class Entity : IEntity, IComparable<Entity>
    {
        private Serial _serial;

        public Serial Serial
        {
            get { return _serial; }
        }

        public bool IsMobile
        {
            get { return _serial.IsMobile; }
        }

        public bool IsItem
        {
            get { return _serial.IsItem; }
        }

        public Entity(Serial serial)
        {
            _serial = serial;
        }

        public int CompareTo(IEntity other)
        {
            if (other == null)
                return -1;

            return _serial.CompareTo(other.Serial);
        }

        public int CompareTo(Entity other)
        {
            return this.CompareTo((IEntity)other);
        }

        public int CompareTo(object other)
        {
            if (other == null || other is IEntity)
                return this.CompareTo((IEntity)other);

            throw new ArgumentException();
        }
    }
}
